package com.fieldIndustry.service.impl;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

import com.base.service.impl.ServiceImpl;
import com.fieldIndustry.pojo.Industryfbd;
import com.fieldIndustry.service.IIndustryfbdService;
import com.sun.org.apache.commons.beanutils.BeanUtils;

public class IndustryfbdServiceImpl<T extends Industryfbd> extends
		ServiceImpl<T> implements IIndustryfbdService<T> {

	@Override
	public boolean create(T industryfbd) {
		List list = dao.createQuery(
				" from Industryfbd d where d.industryFbd = ' "+industryfbd.getIndustryFbd()+"'").list();
		if (list.size() > 0) {
			T industryfbd1= (T) list.get(0);
			try {
				industryfbd1.setIndustryFbdPath(industryfbd.getIndustryFbdPath());
				industryfbd1.setIndustryFbdVersion(industryfbd.getIndustryFbdVersion());
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} 
			dao.save(industryfbd1);
			return false;
		} else

			dao.create(industryfbd);
		return true;

	}

}
